<?php
$maxwight = get_shiping_max_weight();
$shipingprice = get_shiping_price();
$priceforunit = get_shiping_price_for_unit();
?>
<h1><span></span><?= lang('label_wishlist') ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="<?= base_url('user/profile') ?>"><?= lang('label_profile') ?></a></li>
    <li><?= lang('label_wishlist') ?></li>
</ul>


<div class="page">
    <?php
    if ($data) {
        $counter = 1;
        ?>
        <?php
        foreach ($data as $dt) {
            $product = get_product_from_id($dt->product_id);
            $images = unserialize($product->images);
            $nodef = TRUE;
            ?>
            <div class="wishlist">
                <img src="<?php
                if (count($images) > 0) {
                    foreach ($images as $k => $v) {
                        if ($v[1] == 'yes') {
                            $nodef = false;
                            $defimage = $v[0];
                            echo base_url(PRODUCT_PATH . $v[0]);
                        }
                    } if ($nodef) {
                        base_url(PRODUCT_PATH . $images[0][0]);
                        $defimage = $images[0][0];
                    }
                } else {
                    echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) . '/' . APPPATH . 'views/' . $this->themes->Cms_themes() . '/images/noimage_' . LANG . '.gif';
                }
                ?>" alt="" />
                <p>
                    <a href="<?= base_url('products/view/' . $product->id) ?>"><?= $product->name ?></a>
                    <span>&raquo; <a href="<?= base_url("products/category/$product->mcat_id") ?>"><?php $maintitle = unserialize($product->maintitle); echo (isset($maintitle[LANG])) ? $maintitle[LANG] : ((LANG == 'ar') ? $maintitle['en'] : $maintitle['ar']); ?> - <a href="<?= base_url("products/category/$product->subcat_id") ?>"><?php $subtitle = unserialize($product->subtitle); echo (isset($subtitle[LANG])) ? $subtitle[LANG] : ((LANG == 'ar') ? $subtitle['en'] : $subtitle['ar']); ?></a></span>
                    <span>&raquo; <a href="<?= base_url("store/index/$product->store_id") ?>"><?= $product->value ?></a></span>
                    <span>&raquo; <img src="<?= base_url(TRADE_PATH . $product->tradeimage) ?>" alt=""></span>
                </p>

                <h6><?= $counter++ ?></h6>

                <samp>
                    <span><?= lang('label_product_price') ?> : <b><?= ($product->discount_precentage > 0) ? $product->discount_price : $product->price; ?></b> <i><?= lang('label_rial') ?></i></span>
                    <span><?= lang('label_shiping') ?> : <b><?php
                            if ($product->shiping_weghite <= $maxwight) {
                                echo (double) $shipingprice;
                            } else {
                                $weghit = (double) $maxwight - 10;
                                echo $shipingprice + $priceforunit * $weghit;
                            }
                            ?></b> <i><?= lang('label_rial') ?></i></span>
                    <a href="<?= base_url("wishlist/remove/$dt->id") ?>" class="removewish">X <?= lang('label_remove_cart') ?></a>
                </samp>
            </div>
        <?php } ?>
    <?php } else { ?>
        <div class="unsaved">
            <img src="<?php echo str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?php echo APPPATH ?>views/<?php echo $this->themes->Cms_themes() ?>/images/unsaved.png" alt="" >
            <br /><?= lang('message_dont_have_wishlist') ?>
        </div>
        <br /><br /><br /><br />
    <?php } ?>
</div>
